package bocchi.power;

import bocchi.BocchiCore;
import bocchi.base.BaseCustomPower;
import bocchi.stance.DelusionStance;
import com.megacrit.cardcrawl.actions.watcher.ChangeStanceAction;
import com.megacrit.cardcrawl.cards.DamageInfo.DamageType;
import com.megacrit.cardcrawl.core.AbstractCreature;

public class AnxietyPower extends BaseCustomPower {
    private static final String RAW_ID = "Anxiety";
    public static final String GAME_ID = BocchiCore.getGameID(RAW_ID);

    public AnxietyPower(AbstractCreature owner, int amount) {
        super(RAW_ID, PowerType.BUFF, owner, amount);
    }

    @Override
    public void updateDescription() {
        description = String.format(descriptions[0], amount, amount * 3);
    }

    @Override
    public float atDamageGive(float damage, DamageType type) {
        return type == DamageType.NORMAL ? damage - (float) this.amount : damage;
    }

    @Override
    public void stackPower(int stackAmount) {
        super.stackPower(stackAmount);
        if (amount >= 6) {
            addToTop(new ChangeStanceAction(new DelusionStance()));
        }
    }
}
